package com.woniuxy.springparking.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniuxy.springparking.common.RestResult;
import com.woniuxy.springparking.dao.McarParkingDao;
import com.woniuxy.springparking.dao.TPerStallDao;
import com.woniuxy.springparking.pojo.McarParking;
import com.woniuxy.springparking.pojo.TPerStall;
import com.woniuxy.springparking.service.TPerStallService;
import com.woniuxy.springparking.vo.TPerStallVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TPerStallServiceImpl implements TPerStallService {
    @Autowired
    private TPerStallDao tPerStallDao;
    @Override
    public RestResult seletTPByPage(TPerStallVo tsVo) {
        Page<Object> pages = PageHelper.startPage(tsVo.getPage(),tsVo.getLimit());
        List<TPerStall> data=this.tPerStallDao.selectTPStallByPage(tsVo);
        return new RestResult(pages.getTotal(),data);
    }

    @Override
    public void remove(Integer perStallId) {
        this.tPerStallDao.deleteById(perStallId);
    }
}
